﻿using System;
using System.Collections.Generic;
using System.Linq;
using Crosland.Automotriz.Entidad;
namespace Crosland.Automotriz.Data.Dao.Linq
{
    public class clsTD_Zona_RegistralDAO
    {
        private readonly DM_CROSLAND_20130417Entities ContextoDeObjs = new DM_CROSLAND_20130417Entities();

        public List<TD_ZONA_REGISTRAL> Listar()
        {
            List<TD_ZONA_REGISTRAL> lista = new List<TD_ZONA_REGISTRAL>();
            try
            {
                var q = from c in ContextoDeObjs.TD_ZONA_REGISTRAL
                        where c.IND_ACTIVO == true
                        orderby c.NUM_ORDEN ascending
                        select c;
                lista = q.ToList();
            }
            catch (Exception)
            {

            }
            return lista;
        }

        public int ObtenerID_ZONA_REGISTRAL(string COD_ZONA_REGISTRAL) 
        {
            var q = from c in ContextoDeObjs.TD_ZONA_REGISTRAL
                    where c.COD_ZONA_REGISTRAL == COD_ZONA_REGISTRAL
                    select c;
            return q.ToList()[0].ID_ZONA_REGISTRAL;
        }
    }
}
